/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ficha;

import ficha.storyteller.vampiro.AreaFicha;
import ficha.storyteller.vampiro.HabilidadeLabel;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;


/**
 * Renderer para a SkillTable, exibe uma bolinha pintada para cada nivel.
 * suporta nivel 0 a 10
 * @author yurifw
 */
public class SkillCellRenderer implements TableCellRenderer{
    public LabelNivel nivel;
    private AreaFicha areaFicha;
    
    public SkillCellRenderer(AreaFicha areaFicha) {
        this.areaFicha = areaFicha;
    }
    
    
    
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        nivel = new HabilidadeLabel(areaFicha);
        nivel.setNivel(Integer.parseInt(value.toString()));
        if (isSelected){
            nivel.setBackground(table.getSelectionBackground());
            nivel.setForeground(table.getSelectionForeground());
        } else {
            nivel.setBackground(table.getBackground());
            nivel.setForeground(table.getBackground());
        }
        return nivel;
    }
}
